<template>
  <div id="app">
    <div class="top-header-nav" v-if="studentShow">
      <img src="@/assets/img/icon-arrow-left.png" alt="" height="20" @click="$router.go(-1)">
      <span>{{ studentTitle }}</span>
      <router-link to="/myIndex">
        <img v-if="studentInfo.head_sculpture" :src="studentInfo.head_sculpture" alt="" height="24" width="24" style="display: block;border-radius: 50%;overflow: hidden;">
        <img v-else :src="wxAvatar ? wxAvatar : avatar" alt="" height="24" width="24" style="display: block;border-radius: 50%;overflow: hidden;">
      </router-link>
    </div>
    <div :style="{height: studentShow ? 'calc(100% - 44px)' : '100%', 'overflow-y': 'auto'}" class="scroll-box">
      <router-view/>
    </div>
    <div class="share-cover" v-if="studentShare">
      <img src="../../assets/img/share-cover.png" alt="" width="100%" @click="hiddenShare">
    </div>
  </div>
</template>

<script>
import {mapGetters} from 'vuex'
export default {
  name: 'App',
  data () {
    return {
      avatar: require('@/assets/img/icon-avatar.png')
    }
  },
  methods: {
    hiddenShare () {
      this.$store.commit('SET_SHARE_STUDENT', false)
    }
  },
  computed: {
    ...mapGetters([
      'studentInfo',
      'studentTitle',
      'studentShow',
      'studentShare',
      'wxAvatar'
    ])
  }
}
</script>

<style>
*{
  margin: 0;
  padding: 0;
}
body, html{
  height: 100%;
  background-color: #fff;
}
#app {
  font-family: PingFang SC, 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100%;
}
.scroll-box{
  -webkit-overflow-scrolling: touch;
}
.top-header-nav{
  height: 44px;
  padding: 0 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #3A7FE2;
  font-size: 18px;
  font-family: PingFangBlod;
  color: #fff;
}
.share-cover{
  background-color: rgba(0,0,0,.7);
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
}
</style>
